import { message, notification } from 'antd'

export default class NoticeMessage {
  createMessage (json) {
    if (typeof json !== 'object' && !json.type) return
    message[json.type](json.message || '', json.timeout || 2)
  }
  createNotice (json) {
    if (typeof json !== 'object' && !json.type) return
    notification[json.type]({
      message: json.title || '',
      description: json.message || '',
      duration: json.timeout || 3
    })
  }
}
